import axios, {ResponseData} from 'yuxin-base/src/utils/axios'
/**
 * 获取税率列表
 * @param data
 */
export const getTaxRateList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_taxation/pages',
		data,
		method: 'POST'
	})
}

/**
 * 根据税率id获取详情
 */
export const getTaxRateDetails = (invOrgId: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/org_taxation/${invOrgId}`,
		method: 'get'
	})
}

/**
 * 新增配置
 */
export const addTaxRateData = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_taxation/add',
		data,
		method: 'POST'
	})
}

/**
 * 获取开票主体
 */
export const getInvoicingSubjectList = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_info/available_list',
		data,
		method: 'POST'
	})
}

/**
 * 获取费用类型
 * @param
 * @returns
 */
export const listDict = (): Promise<ResponseData> => {
	return axios.request({
		url: '/system/dictionary/list_dict/FEESUBJECT',
		method: 'GET'
	})
}

/**
 * 修改税率配置
 */
export const updateTaxRate = (data: object): Promise<ResponseData> => {
	return axios.request({
		url: '/finance/invoice/org_taxation/update',
		data,
		method: 'POST'
	})
}

/**
 * 删除税率配置
 */
export const deleteTaxRate = (invOrgId: string): Promise<ResponseData> => {
	return axios.request({
		url: `/finance/invoice/org_taxation/${invOrgId}`,
		method: 'DELETE'
	})
}
